Public Class ZipCodeAdmin

    Private Sub ZipCodeAdmin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DsTempList.TBL_ZIPCODES' table. You can move, or remove it, as needed.
        Me.TBL_ZIPCODESTableAdapter.Fill(Me.DsTempList.TBL_ZIPCODES)
        Me.DsTempList.AcceptChanges()

    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        If Me.txtState.Text.Trim = "" Then
            MessageBox.Show("Invalida State Value", "Virtual Desk", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Exit Sub
        End If
        If Me.txtCity.Text.Trim = "" Then
            MessageBox.Show("Invalida City Value", "Virtual Desk", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Exit Sub
        End If
        If Me.txtZipcode.Text.Trim = "" Then
            MessageBox.Show("Invalida Ziocode Value", "Virtual Desk", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Exit Sub
        End If
        TBLZIPCODESBindingSource.EndEdit()
        TBL_ZIPCODESTableAdapter.Update(Me.DsTempList.TBL_ZIPCODES)
    End Sub

    Private Sub btnAddNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNew.Click
        Me.TBLZIPCODESBindingSource.AddNew()
        Me.btnDelete.Enabled = False
        Me.btnCancel.Enabled = True
    End Sub

    Private Sub DataGridView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.Click
        If DataGridView1.SelectedRows.Count > 0 Then
            Me.btnDelete.Enabled = True
            Me.btnCancel.Enabled = False
        End If
    End Sub

    
End Class